CHARTS
Photo by Karim Manjra on Unsplash
Let Girls Be Girls, Not Brides…
— UN Secretary-General Ban Ki-Moon - 2012
url_root <- "https://raw.githubusercontent.com/UN-AVT/kamino-source/main/sources/0-shared/data/"
url_file <- "child-marriage-bar-dot/Child_Marriage.csv"
url <- paste0(url_root, url_file)
df <- read.csv(url)
df
df_wrangle <- df %>% janitor::clean_names()
df_wrangle <- df_wrangle %>% arrange(desc(females_married_by_18)) %>%
filter(!is.na(males_married_by_18)) %>%
head(37)
df_wrangle
theme_opts <- theme(
text = element_text(family = "inconsolata", size = 16),
# plot.title = element_text(color = "black", size = 16, face = "bold"),
plot.title = element_markdown(lineheight = 1.1),
plot.subtitle = element_text(color = "black", size = 12),
plot.caption = element_text(color = "#555555", size = 10),
plot.margin = margin(.25, .5, .25, .5, "in"),
plot.background = element_blank(),
panel.background = element_blank(),
legend.position = "none",
axis.title.x=element_blank(),
axis.title.y=element_blank(),
axis.ticks.x=element_blank(),
# axis.ticks.y=element_blank(),
axis.text.x=element_blank(),
panel.grid.minor.x = element_blank(),
panel.grid.minor.y = element_blank(),
panel.grid.major.x = element_blank(),
panel.grid.major.y = element_blank()
)
# Make the plot
v1 <- ggplot(df_wrangle, aes(x=females_married_by_18, y=reorder(country, females_married_by_18))) +
geom_bar(stat="identity", fill="#F44336") +
geom_point(aes(x=males_married_by_18, y=reorder(country, females_married_by_18)), shape = 21, fill="#111111", colour="#ffffff", size = 4) +
geom_text(aes(x=females_married_by_18+0.03, y=reorder(country, females_married_by_18),
label = paste0(round(100*females_married_by_18),"%")),
colour="#111111", size = 5, vjust=+0.4, family = "inconsolata") +
geom_text(aes(x=males_married_by_18+0.04, y=reorder(country, males_married_by_18),
label = paste0(round(100*males_married_by_18),"%")),
colour="#ffffff", size = 5, vjust=+0.4, family = "inconsolata") +
labs(title = "<span style='font-size:18pt'> Percent of
<span style='color:#F44336;'>Females</span>
married at 18 vs.
<span style='color:#111111;'>Males</span> married by 18
</span>
<br>
<span style='font-size:15pt'><span style='color:#565657;'>
[ Percentages are rounded ]
</span>
</span>",
x = NULL, y = NULL)+
theme_minimal() +
theme_opts
girafe(ggobj = v1, width_svg = 16, height_svg = 9,
options = list(opts_sizing(rescale = TRUE, width = 0.8)))